Computer exploit detection using heap spray pattern matching

ABSTRACT

According to one embodiment, a threat detection system is integrated with at least a dynamic analysis engine. The dynamic analysis engine is configured to automatically to detect potential shellcode at a first storage location within a region of memory allocated for an application, conduct a first search at one or more storage locations prior to the first storage location within the region of allocated memory for at least one or more patterns, conduct a second search at one or more storage locations subsequent to the first storage location within the region of allocated memory for at least one or more patterns, detect a first pattern at one or more storage locations prior to the first storage location within the region of allocated memory, and detect a second pattern at one or more storage locations subsequent to the first storage location with the region of allocated memory, wherein at least one of the first pattern or the second pattern is absent from a predefined list of patterns.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims the benefit of priority on U.S. Provisional Application No. 62/009,132, filed Jun. 6, 2014, the entire contents of which are incorporated by reference herein.

FIELD

Embodiments of the disclosure relate to the field of cyber security. More specifically, embodiments of the disclosure relate to a system, apparatus and method for detecting a heap spray attack in memory allocated to a software component such as an application or operating system (OS).

GENERAL BACKGROUND

Over the last decade, malicious software has become a pervasive problem for Internet users as many networked resources include vulnerabilities that are susceptible to attack. For instance, over the past few years, more and more vulnerabilities are being discovered in software that is loaded onto network devices, such as vulnerabilities within operating systems for example. While some vulnerabilities continue to be addressed through software patches, prior to the release of such software patches, network devices will continue to be targeted for attack by exploits, namely information such as computer code that attempts to take advantage of a vulnerability in computer software by acquiring sensitive information or adversely influencing or attacking normal operations of the network device or the entire enterprise network.

In particular, a technique known as “heap spraying” allows an exploit residing within software of a network device to more easily take advantage of a vulnerability within software (e.g., an application or an operating system) running on the network device. During a heap spray attack, an exploit inserts a portion of code including a sequence of No Operation (NOP) instructions and a sequence of bytes at a particular location within memory of the network device. The sequence of bytes may be directed at performing malicious activity, wherein the sequence of bytes may be in the form of code, commonly referred to as “shellcode.” This particular location is a predictable memory location within a heap (e.g., a predetermined amount of virtual memory allocated for the software). Once code has been inserted into the heap, the exploit may be triggered during processing which causes the application to execute the shellcode thereby allowing the exploit to assume control of the execution of code on the network device. This enables the attacker to execute instructions on the network device which may be malicious to the network device, to its content or to the owner of the network device. Heap spray attacks use chunks of No Operation (NOP) instructions, also known as NOP sleds, to facilitate the execution of the shellcode. By orienting a NOP sled at an address just prior to shellcode, the execution flow of the processing unit of the network device is quickly directed to the shellcode.

The NOP instructions may be a sequence of known instructions (e.g., “patterns”). Conventional heap spray detection methods attempt to identify heap spray attacks by detecting the NOP sleds and comparing the sequence of NOP instructions to NOP instructions appearing on a list of permitted (and non-malicious) NOP instructions. Such a list may be referred to as a “whitelist” of NOP instructions. Those sequences of NOP instructions found on the whitelist are dismissed as non-malicious. However, those sequences of NOP instructions found in the heap but not found on the whitelist are flagged as a probable NOP sled portion of a heap spray attack.

Several issues with a detection strategy using a whitelist of NOP instructions exist. First, comparing sequences of NOP instructions to NOP instructions appearing on a whitelist results in a high number of false positives as a whitelist rarely contains all possible permitted or non-malicious NOP instructions. Several non-malicious NOP instructions not appearing on the whitelist may reside in received network traffic. This in turn prompts the detection system to improperly flag one or more objects within the network traffic as containing or, viewed differently, instigating, when processed, a heap spray attack and return a false positive to a network administrator.

Second, as false positives are reported, the NOP instruction that caused the false positive is typically added to the whitelist in order to prevent future false positives based on that particular non-malicious NOP instruction. However, a whitelist of all possible non-malicious NOP instructions is untenable because such as list would require constant updating.

BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of the invention are illustrated by way of example and not by way of limitation in the figures of the accompanying drawings, in which like references indicate similar elements and in which:

FIG. 1 is an exemplary block diagram of an operational flow of threat detection and prevention within a network device.

FIG. 2A is an exemplary block diagram of a communication system deploying a plurality of threat detection and prevention (TDP) systems communicatively coupled to a management system via a network.

FIG. 2B is a second exemplary block diagram of a communication system deploying a plurality of threat detection and prevention (TDP) systems communicatively coupled to a management system via a network.

FIG. 3 is an exemplary block diagram of a monitoring logic to monitor the allocation of virtual memory for an application within a virtual machine (VM).

FIG. 4A is an exemplary graph plotting time over memory illustrating the memory allocation for an instance of an application executing in a virtual machine (VM).

FIG. 4B is a second exemplary graph plotting time over memory illustrating the memory allocation for an instance of an application executing in a virtual machine (VM).

FIG. 5 is a flowchart of an exemplary method for detecting a heap spray attack based on the detection of a blacklisted pattern.

FIGS. 6A-6D are flowcharts illustrating an in-depth exemplary method for detecting a heap spray attack based on the detection of a blacklisted pattern.

FIG. 7 is a flowchart of an exemplary method for detecting a new NOP sled pattern.

FIG. 8 is an exemplary block diagram of a virtual heap allocated for an application executing an object included in received network traffic.

FIG. 9 is an exemplary block diagram of logic associated with the threat detection and prevention (TDP) system of FIGS. 2A-2B.

FIG. 10 is an exemplary illustration of a mobile network device configured with a heap spray detection logic.

DETAILED DESCRIPTION

Various embodiments of the invention determine whether an object of network content or other digital content is attempting to utilize a heap spray attack in efforts to increase the likelihood of successfully exploiting a vulnerability. The determination entails an analysis of an application's memory allocation, followed by analysis and detection of patterns of instructions found within one or more memory regions allocated for the application. The contents of the memory region(s) are matched against patterns known or believed to be associated with heap spray attacks and/or new detected patterns that are likely, based on one or more predetermined characteristics and “pattern learning,” to be associated with a heap spray attack.

Embodiments using heap spray pattern matching for exploit detection may employ the following technique: First, determine whether an operating system, for example, responsive to an application's memory request, has allocated excessive (e.g., atypically high number of bytes of) memory to the application over a predetermined length of time during run-time (e.g., allocation amount and allocation rate). Second, when excessive memory has been allocated, seek to identify patterns of instructions stored in the allocated memory evidencing a heap spray attack. If excessive memory allocation is not found, the second step is not triggered. In some more-efficient embodiments, rather than scanning all allocated memory locations for such patterns in the second step, sampling techniques are employed to scan (at least initially) only specific regions of such memory locations. Since memory is usually allocated in one or more regions of contiguous blocks, these techniques may scan for pattern of instructions stored in specific regions of those allocated regions, for example, in regions exceeding a predetermined size, and also at addresses of such regions located (i) at a first position at or near (within a specific number of bytes from) the beginning of each region, (ii) at a second position at or near (within a specific number of bytes from) the end of the region, and (iii) at a third position intermediate the first and second positions (e.g., at a larger offset from the beginning (or, in a variation, the end) of the region).

More specifically, embodiments of the invention may perform such scanning by ascertaining the regions allocated to a process, e.g., by querying the process itself or the operating system. Since the allocated memory may be fragmented into smaller regions, those embodiments may identify for scanning only regions having a size (e.g., in bytes) above a threshold value. Then, these embodiments scan the identified regions for predetermined patterns of stored instructions. For instance, the patterns may be No Operation (NOP) instruction patterns, which often evidence (have a high correlation with the occurrence of) a heap spray attack, based on previous experience with detected attacks.

If evidence of a heap spray attack is uncovered, the object may be classified as “suspicious,” that is, associated with a probable exploit or malware. In some embodiments, a correlation engine may associate the object with a score, weight or threat level corresponding to a probability that the object is associated with an exploit, and may also classify the object as malicious if the score exceeds a threshold.

Embodiments of the invention may be employed by or take the form of a network device or apparatus implementing a threat detection and prevention (TDP) system, where the network device comprises a dynamic analysis engine for monitoring and analyzing behavior of objects during processing in a virtual runtime environment. In some embodiments, the TDP system may be implemented or executed by a server or client device or other system (called an “endpoint”) connectable to a network. In other embodiments, the TDP system may be a dedicated cyber-security appliance or general purpose computer system. The TDP system may include an optional static analysis engine as well as the dynamic analysis engine. According to one embodiment of the disclosure, the static analysis engine operates as a filter that analyzes information associated with characteristics of one or more objects extracted from monitored network traffic in efforts to determine if the characteristics are anomalous and thus indicative of an exploit. If so, the object(s) are labeled “suspicious.” The dynamic analysis engine may include virtual execution logic to automatically process and analyze, without user assistance, content within object(s) of the received network traffic. Furthermore, the dynamic analysis engine may include monitoring logic to automatically instantiate and execute an application to execute or otherwise process an object within received network traffic and analyze the memory allocation for the application and patterns of instructions stored therein in order to detect a heap spray attack in accordance with any of the techniques and embodiments described herein.

I. TERMINOLOGY

In the following description, certain terminology is used to describe features of the invention. For example, in certain situations, both terms “logic” and “engine” are representative of hardware, firmware and/or software that is configured to perform one or more functions. As hardware, logic (or engine) may include circuitry having data processing or storage functionality. Examples of such circuitry may include, but are not limited or restricted to a microprocessor, one or more processor cores, a programmable gate array, a microcontroller, an application specific integrated circuit, wireless receiver, transmitter and/or transceiver circuitry, semiconductor memory, or combinatorial logic.

Logic (or engine) may be software in the form of one or more software modules, such as executable code in the form of an executable application, an application programming interface (API), a subroutine, a function, a procedure, an applet, a servlet, a routine, source code, object code, a shared library/dynamic load library, or one or more instructions. These software modules may be stored in any type of a suitable non-transitory storage medium, or transitory storage medium (e.g., electrical, optical, acoustical or other form of propagated signals such as carrier waves, infrared signals, or digital signals). Examples of non-transitory storage medium may include, but are not limited or restricted to a programmable circuit; a semiconductor memory; non-persistent storage such as volatile memory (e.g., any type of random access memory “RAM”); persistent storage such as non-volatile memory (e.g., read-only memory “ROM”, power-backed RAM, flash memory, phase-change memory, etc.), a solid-state drive, hard disk drive, an optical disc drive, or a portable memory device. As firmware, the executable code is stored in persistent storage.

The term “object” generally refers to a collection of data, whether in transit (e.g., over a network) or at rest (e.g., stored), often having a logical structure or organization that enables it to be classified for purposes of analysis. During analysis, for example, the object may exhibit a set of expected characteristics and, during processing, a set of expected behaviors. The object may also exhibit a set of unexpected characteristics and a set of unexpected behaviors that may evidence an exploit and potentially allow the object to be classified as an exploit.

Examples of objects may include one or more flows or a self-contained element within a flow itself. A “flow” generally refers to related packets that are received, transmitted, or exchanged within a communication session. For convenience, a packet is broadly referred to as a series of bits or bytes having a prescribed format, which may include packets, frames, or cells.

As an illustrative example, an object may include a set of flows such as (1) a sequence of transmissions in accordance with a particular communication protocol (e.g., User Datagram Protocol (UDP); Transmission Control Protocol (TCP); or Hypertext Transfer Protocol (HTTP); etc.), or (2) inter-process communications (e.g., Remote Procedure Call “RPC” or analogous processes, etc.). Similar, as another illustrative example, the object may be a self-contained element, where different types of such objects may include an executable file, non-executable file (such as a document or a dynamically link library), a Portable Document Format (PDF) file, a JavaScript file, Zip file, a Flash file, a document (for example, a Microsoft Office® document), an electronic mail (email), downloaded web page, an instant messaging element in accordance with Session Initiation Protocol (SIP) or another messaging protocol, or the like.

An “exploit” may be construed broadly as information (e.g., executable code, data, command(s), etc.) that attempts to take advantage of a vulnerability. Typically, a “vulnerability” is a coding error or artifact of software (e.g., computer program) that allows an attacker to alter legitimate control flow during processing of the software (computer program) by a network device, and thus, causes the network device to experience undesirable or unexpected behaviors. The undesired or unexpected behaviors may include a communication-based anomaly or an execution-based anomaly, which, for example, could (1) alter the functionality of an network device executing application software in a malicious manner; (2) alter the functionality of the network device executing that application software without any malicious intent; and/or (3) provide unwanted functionality which may be generally acceptable in another context. To illustrate, a computer program may be considered as a state machine, where all valid states (and transitions between states) are managed and defined by the program, in which case an exploit may be viewed as seeking to alter one or more of the states (or transitions) from those defined by the program.

Malware may be construed broadly as computer code that executes an exploit to take advantage of a vulnerability, for example, to harm or co-opt operation of a network device or misappropriate, modify or delete data. Conventionally, malware is often said to be designed with malicious intent. An object may constitute or contain malware, for example, shellcode may be injected into a heap during a heap spray attack.

The term “shellcode” refers to a small piece of executable code that resides in data (e.g., is injected into data), is used as a payload of malware, and, in some cases, contains a shell command to execute an exploit.

The term “transmission medium” is a physical or logical communication path between two or more network devices (e.g., any devices with data processing and network connectivity such as, for example, a security appliance, a server, a mainframe, a computer such as a desktop or laptop, netbook, tablet, firewall, smart phone, router, switch, bridge, etc.). For instance, the communication path may include wired and/or wireless segments. Examples of wired and/or wireless segments include electrical wiring, optical fiber, cable, bus trace, or a wireless channel using infrared, radio frequency (RF), or any other wired/wireless signaling mechanism.

In certain instances, the term “detected” is used herein to represent that there is a prescribed level of confidence (or probability) on the presence of an exploit or heap spray attack within an object under analysis. For instance, the virtual execution logic may detect the presence of a heap spray attack by monitoring or observing unexpected or anomalous behaviors or activities, and, in response, determining that the object includes a heap spray attack.

The term “pattern” should be construed as a predefined sequence of instructions. A pattern may appear in memory, such as memory allocated in a virtual execution environment for use by an application being executed by a virtual machine. In some embodiments, the length of the pattern may correspond to the operating system of the network device which is undergoing analysis. For example, a pattern may consist of four bytes when the network device is running a 32-bit operating system (this may be referred to as a double word, or “DWORD”). Therefore, the DWORD may contain up to four (4) instructions, which may be four (4) NOP instructions, for example. Alternatively, a pattern may consist of eight bytes when the network device is running a 64-bit operating system (this may be referred to as a quad word, or “QWORD”). Therefore, the QWORD may contain up to eight (8) instructions, which may be eight (8) NOP instructions, for example.

In addition, a blacklisted pattern is a pattern that has been preselected and placed on a list comprising one or more preselected patterns. A blacklist may be used in a comparison to, among other things, determine whether the particular item in the comparison needs to be flagged as being associated with a malicious attack.

The term “NOP instruction” should be construed as a computer instruction that only causes an increment of the program counter by the length of the NOP instruction. A pattern may be, or include, one or more NOP instructions.

The term “NOP sled” should be construed as a sequence of NOP instructions constituting a pattern. A NOP sled may also be a sequence of instructions that collectively do not change the state of the process when executed. Accordingly, while an individual instruction within the NOP sled may change the state of the process, another instruction in the NOP sled would operate to reverse that change, yielding no net change of state. NOP sleds are commonly used with heap spray attacks in order to facilitate the execution of shell code.

The term “network device” should be construed as any electronic device with the capability of connecting to a network. Such a network may be a public network such as the Internet or a private network such as a wireless data telecommunication network, wide area network, a type of local area network (LAN), or a combination of networks. Examples of a network device may include, but are not limited or restricted to, a laptop, a mobile phone, a tablet, a computer, etc.

The term “computerized” generally represents that any corresponding operations are conducted by hardware in combination with software and/or firmware. Also, the terms “compare” or “comparison” generally mean determining if a match (e.g., a certain level of correlation) is achieved between two items where one of the items may include a particular signature pattern.

Lastly, the terms “or” and “and/or” as used herein are to be interpreted as inclusive or meaning any one or any combination. Therefore, “A, B or C” or “A, B and/or C” mean “any of the following: A; B; C; A and B; A and C; B and C; A, B and C.” An exception to this definition will occur only when a combination of elements, functions, steps or acts are in some way inherently mutually exclusive.

The invention may be utilized for detection, verification and/or prioritization of malicious content such as exploits and/or heap spray attacks. As this invention is susceptible to embodiments of many different forms, it is intended that the present disclosure is to be considered as an example of the principles of the invention and not intended to limit the invention to the specific embodiments shown and described.

II. FIRST EMBODIMENT Heap Spray Detection within a TDP System A. Heap Spray Detection Methodology

Referring to FIG. 1, an exemplary block diagram of an operational flow for heap spray detection by a network device 100 (e.g. a TDP system) is shown. Herein, some or all of the incoming objects 110 associated with monitored network traffic are received by virtual execution logic 270, which is part of a dynamic analysis engine 130 (see FIGS. 2A-2B), either directly or via an optional static analysis engine 120. According to one embodiment of the disclosure, when deployed in the network device 100, the static analysis engine 120 is configured as a capture and filter device that receives the incoming objects 110 and conducts heuristics analysis, exploit signature checks and/or vulnerability signature checks, for example, on some or all of the objects 110, as described below, to identify “suspicious” objects having one or more characteristics associated with an exploit.

The virtual execution logic 270 conducts an in-depth analysis of an object, for example, each suspicious object, of the incoming objects 110 by creating and executing an instance of an application to virtually process the object and analyze, for example, the application's memory allocation and, if triggered, patterns detected within the allocated memory. The virtual execution logic 270 may compare the amount of memory allocated to a predetermined threshold over a predefined time interval and compare detected patterns with either patterns known to be associated with heap spray attacks or patterns known to be non-malicious.

Upon conducting at least an analysis of (i) the memory allocation for an application used to process the suspicious object of the incoming objects 110 and if triggered, (ii) detected patterns stored within memory allocated to the process, the dynamic analysis engine 130 provides the results 150 of its analysis (referred to herein as “VM-based results”) to reporting logic 160 for storage in database 255 and subsequent access. If implemented as part of the network device 100, the static analysis engine 120 provides results 140 of its analysis (referred to herein as “static-based results”) to reporting logic 160 for storage in database 255 and subsequent access.

Thereafter, at least portions of the static-based results 140 and the VM-based results 150 for the incoming objects 110 may be combined by the reporting logic 160. The reporting logic 160 may issue an alert or report 170 (e.g., an email message, text message, display screen image, etc.) to security administrators for example, communicating the urgency in handling one or more detected heap spray attacks. Alternatively, the alert or report 170 may trigger a further analysis of the object to verify the behavior of the object as an exploit.

According to one embodiment of the disclosure, the communicative coupling between the static analysis engine 120 and the dynamic analysis engine 130 is provided in a serial configuration, where the incoming object(s) 110 (or a copy thereof) may be processed in the virtual execution logic 270 after analysis by the static analysis engine 120. However, it is contemplated that the static analysis engine 120 and the dynamic analysis engine 130 may be provided in a parallel configuration, where the incoming object(s) 110 (or copy thereof) may be processed in the virtual execution logic 270 concurrently with analysis of objects by the static analysis engine 120.

B. General Architecture of Network Device Deploying Heap Spray Detection Logic

Referring to FIG. 2A, an exemplary block diagram of a heap spray detection environment 200 deploying a plurality of threat detection and prevention (TDP) systems 210 ₁-210 _(N) (N>1, e.g., N=3) communicatively coupled to a management system 220 via a network 225 is shown. The heap spray detection environment 200 comprises a server device 232, an optional firewall 236, a client device 234 and a TDP system 210 ₁ communicatively coupled to the network 230 via a network interface 238. The TDP system 210 ₁ is further communicatively coupled to the management system 220 and one or more TDP systems 210 ₂-210 ₃ via the network 225. In general, management system 220 is adapted to manage TDP systems 210 ₁-210 ₃. For instance, management system 220 is responsible for automatically updating a blacklist of NOP instruction patterns used by the virtual execution logic 270 within some or all of TDP systems 210 ₁-210 _(N).

Herein, according to the embodiment illustrated in FIG. 2A, a first TDP system 210 ₁ is a network device that is adapted to analyze information associated with network traffic routed over a communication network 230 between at least one server device 232 and at least one client device 234. The communication network 230 may include a public network such as the Internet, in which case an optional firewall 236 (represented by dashed lines) may be interposed in the communication path between the public network and the client device 234. Alternatively, the communication network 230 may be a private network such as a wireless data telecommunication network, wide area network, a type of local area network (LAN), or a combination of networks.

As shown, the first TDP system 210 ₁ may be communicatively coupled with the communication network 230 via a network interface 238. In general, the network interface 238 operates as a data capturing device (sometimes referred to as a “tap” or “network tap”) that is configured to receive data propagating to/from the client device 234 and provide at least some of this data to the first TDP system 210 ₁. Alternatively, as shown in FIG. 2B, the first TDP system 210 ₁ may be positioned behind the firewall 236 and in-line with client device 234.

According to one embodiment of the disclosure, the network interface 238 is capable of receiving and routing objects associated with network traffic to the first TDP system 210 ₁. The network interface 238 may provide the entire object or certain content within the object, for example, one or more files that are part of a set of flows, packet payloads, or the like. In some embodiments, although not shown, network interface 238 may be contained within the first TDP system 210 ₁.

It is contemplated that, for any embodiments where the first TDP system 210 ₁ is implemented as a dedicated appliance or a dedicated computer system, the network interface 238 may include an assembly integrated into the appliance or computer system that includes a network interface card and related logic (not shown) for connecting to the communication network 230 to non-disruptively “tap” network traffic propagating through firewall 236 and provide either a duplicate copy of at least a portion of the network traffic or at least a portion the network traffic itself to the dynamic analysis engine 130 and the optional static analysis engine 120, if included within the TDP system 210 ₁. In other embodiments, the network interface 238 can be integrated into an intermediary device in the communication path (e.g., firewall 236, router, switch or other networked network device, which in some embodiments may be equipped with Switched Port Analyzer “SPAN” ports) or can be a standalone component, such as an appropriate commercially available network tap. In virtual environments, a virtual tap (vTAP) can be used to duplicate files from virtual networks.

As further shown in FIG. 2A, the first TDP system 210 ₁ comprises the optional static analysis engine 120, a scheduler 260, a storage device 265, the dynamic analysis engine 130 and the reporting logic 160.

In some embodiments, as shown in FIGS. 2A-2B, the static analysis engine 120 may include one or more software modules that, when executed by one or more processors, performs static scanning on a particular object, namely heuristics analysis, exploit signature checks and/or vulnerability signature checks for example. The static analysis engine 120 and the dynamic analysis engine 130 may be one or more software modules executed by the same processor or different processors, where these different processors may be located within the same processor package (e.g., different processor cores) and/or located at remote or even geographically remote locations that are communicatively coupled (e.g., by a dedicated communication link) or a network.

More specifically, as shown, static analysis engine 120 may be configured with heuristics logic 250, exploit matching logic 252, and/or vulnerability matching logic 253. Heuristics logic 250 is adapted for analysis of certain portions of an object under analysis to determine whether any portion corresponds to either (i) a “suspicious” identifier such as either a particular Uniform Resource Locator “URL” that has previously been determined as being associated with known exploits, a particular source or destination (IP or MAC) address that has previously been determined as being associated with known exploits; (ii) a particular exploit pattern; or (iii) a particular shellcode pattern. When deployed, the exploit matching logic 252 may be adapted to perform exploit signature checks, which may involve a comparison of an object under analysis against one or more pre-stored exploit signatures (e.g., pre-configured and predetermined attack patterns) from signature database 251. Additionally or in the alternative, the static analysis engine 120 may be configured with vulnerability matching logic 253 that is adapted to perform vulnerability signature checks, namely a process of uncovering deviations in messaging practices set forth in applicable communication protocols (e.g., HTTP, TCP, etc.). The term “signature” designates an indicator of a set of characteristics and/or behaviors exhibited by one or more exploits that may not be unique to those exploit(s). Thus, a match of the signature may indicate to some level of probability, often well less than 100%, that an object constitutes an exploit. In some contexts, those of skill in the art have used the term “signature” as a unique identifier or “fingerprint,” for example, of a specific virus or virus family (or other exploit), which is generated for instance as a hash of its machine code, and that is a special sub-case for purposes of this disclosure.

A score determination logic 278 (which will be discussed in further detail below) may be implemented within the static analysis engine 120 to generate a score that represents a probability (or level of confidence) that the object under analysis is associated with a malicious attack. For instance, the score may be based, at least in part, on (i) pattern matches; (ii) heuristic or determinative analysis results; (iii) analyzed deviations in messaging practices set forth in applicable communication protocols (e.g., HTTP, TCP, etc.); (iv) analyzed compliance with certain message formats established for the protocol (e.g., out-of-order commands); and/or (v) analyzed header or payload parameters to determine compliance. Where the score exceeds a prescribed value, the object under analysis is deemed “suspicious”; and where it exceeds another, higher prescribed value, the object under analysis may be classified as malware.

The static analysis engine 120 may route suspicious objects (and, in many cases, even previously classified malicious objects) to the virtual execution logic 270 within dynamic analysis engine 130. The dynamic analysis engine 130 is configured to provide more in-depth analysis of objects included in the received network traffic and/or suspicious object(s) from the static analysis engine 120 by analyzing the content of the object(s) as well as the memory allocation for an application processing the object(s).

More specifically, if the optional static scanning is conducted, upon its completion, the static analysis engine 120 may provide a suspicious object to the dynamic analysis engine 130 for in-depth dynamic analysis using virtual machines (VMs) 275 ₁-275 _(M) (M≧1). For instance, the dynamic analysis engine 130 may simulate transmission and/or receipt of packets or other objects by a destination device comprising the virtual machine. In one embodiment, if the object is not suspected of being an exploit, the static analysis engine 120 may simply denote that the object is non-malicious and no further analysis is conducted.

According to one embodiment, one or more VMs 275 ₁-275 _(M) within the virtual execution environment 272 may be configured each with at least one of the available software profiles corresponding to the software images stored within storage device 265 appropriate for processing the suspicious object. Alternatively, the VMs 275 ₁-275 _(M) may be configured according to a prevalent software configuration, software configuration used by a network device within a particular enterprise network (e.g., client device 234), or an environment that is associated with the object to be processed, including software such as a web browser application, PDF™ reader application, or the like. However, for a known vulnerability which occurs after a successful match during a vulnerability signature check for example, the VMs 275 ₁-275 _(M) may be more narrowly configured to software profiles associated with vulnerable software. For example, a particular version of an application may be used by the VMs 275 ₁-275 _(M).

The scheduler 260 may be adapted to configure the multiple VMs 275 ₁-275 _(M) for concurrent virtual execution of a variety of different versions of the software in efforts to detect whether an object included within the received network traffic is attempting to utilize a heap spray attack. Of course, it is contemplated that the VM configuration described above may be handled by logic other than the scheduler 260. For instance, although not shown, the static analysis engine 120 and/or dynamic analysis engine 130 may include configuration logic to handle VM configuration as well.

The dynamic analysis engine 130 is adapted to execute one or more VMs 275 ₁-275 _(M) to detect an attempt to utilize a heap spray attack by simulating the execution of an object under analysis within a run-time environment as expected by the type of object. For example, the dynamic analysis engine 130 analyzes the received network traffic and determines which application is suitable for executing an object of the received network traffic within one or more VMs 275 ₁, . . . , and/or 275 _(M). The monitoring logic 276 instantiates an instance of the application within the virtual execution environment 272 to open/execute the object. The monitoring logic 276 monitors the allocation of memory for the application and is equipped with a software agent or other executable module located within the virtual environment. The software agent or other executable module operates in conjunction with the application instance 310 (i.e., process) to obtain information and perform various tasks for the monitoring logic 276 such as, among others, detecting activities initiated by the application 310 and obtaining information required in detecting potential shellcode and/or anomalous behavior indicative of an exploit.

Furthermore, in one embodiment, the monitoring logic 276 may be implemented as one or more software modules. For instance, as is seen in FIG. 9, the monitoring logic 276 may comprise a memory determination module 940 to determine whether an amount of memory allocated for an application exceeds a predetermined threshold over a predetermined time interval, a scanning module 942 to scan the region of allocated memory for a pattern of instructions in response to determining the amount of allocated memory exceeds the predetermined threshold, and a heap spray determination module 944 to determine, based on the scanning, whether characteristics of a heap spray attack have been detected.

Referring to FIG. 3, an exemplary block diagram of the monitoring logic 276 to monitor the allocation of virtual memory for an application within a VM 275 ₁ is shown. In the embodiment shown, virtual execution logic 270 is shown to include the monitoring logic 276, a score determination logic 278 and virtual execution environment 272 containing VM 275 ₁. In the illustration, the monitoring logic 276 opens an instance of an application 310 (for example, a browser such as Internet Explorer®) through an open process operation 300. The open process operation 300 creates a handle 301 which enables the monitoring logic 276 to monitor the memory allocated for application 310. The monitoring logic 276 may then obtain information about virtual memory allocated by the application 310 through the use of queries, such as a Windows® system call for example. Examples of information the queries may return include, but are not limited or restricted to, (i) the size of the region of virtual memory allocated, (ii) the size of particular regions of memory within the region of virtual memory allocated, (iii) addresses of particular regions of memory within the region of virtual memory allocated, and/or (iv) the permissions of particular regions of memory within the region of virtual memory allocated (wherein the permissions may include whether the region of memory is set in a read, write, and/or executable permission).

The monitoring logic 276 observes the application 310 as it allocates a “virtual” heap 320 within VM 275 ₁. The monitoring logic 276 is equipped with a monitoring module 321. The monitoring module 321 obtains information and performs various tasks for the monitoring logic 276 such as, among others, performing API hooking, detecting potential shellcode, detecting return-oriented programming (ROP), detecting NOP sleds and scanning the allocated virtual heap 320 for patterns to be added to a pattern blacklist (to be discussed below).

If the allocation of memory exceeds a predetermined threshold, the monitoring logic 276 observes the allocated memory over a predefined time interval. If the allocated memory remains above the predefined threshold for the entirety of the interval, the monitoring logic 276 concludes that the object includes a heap spray attack. The portion of the monitoring logic performing functionalities described above and/or below may be referred to “heap spray detection logic.”

Referring to FIG. 4A, an exemplary graph plotting time over memory illustrating the memory allocation for an instance of an application executing in a virtual machine is shown. In FIG. 4A, the allocation of memory exceeds a predetermined threshold when time equals 3 seconds. The allocation of memory exceeds the threshold for the entirety of a time interval (for example, Interval 1 is 3-6 seconds in duration). Based on the graph depicted in FIG. 4A, the monitoring logic 276 observing the memory allocation would assign a memory allocation score to the object, the memory allocation score signifying a first probability that the object that made the call is associated with a heap spray attack.

Referring to FIG. 4B, a second exemplary graph plotting time over memory illustrating the memory allocation for an instance of an application executing in a virtual machine is shown. In FIG. 4B, the allocation of memory exceeds a predetermined threshold of when time equals 3 seconds. In contrast to FIG. 4A, the allocation of memory does not exceed the threshold for the entirety of the interval (e.g., Interval 2 is 3-6 seconds in duration). Based on the graph depicted in FIG. 4B, the monitoring logic 276 observing the memory allocation would disregard the event of the memory allocation initially exceeding the threshold and not assign a memory allocation score to the object based on the memory allocation for the application (or alternatively would assign a memory allocation score of zero).

As an example, the monitoring logic 276 may determine that a PDF file is included within the received network traffic and therefore instantiate an instance of Adobe® Reader®. The monitoring logic 276 opens the PDF file using Adobe® Reader® within virtual execution environment 272 and monitors the amount of memory allocated for Adobe® Reader®. If the amount of memory allocated exceeds a predetermined threshold for the entirety of a prescribed time interval, such as a three (3) second interval for example, the monitoring logic 276 concludes that the PDF file includes a probable heap spray attack. The monitoring logic 276 may then assign a memory allocation score indicating a potential heap spray attack to the object. However, if the allocated memory dips below the predetermined threshold during the prescribed time interval, the monitoring logic 276 disregards the event (the allocated memory exceeding the predetermined threshold) as a mere spike in allocated memory for an action such as downloading a large image over the network 230 (or alternatively, or in addition, assign a memory allocation score of zero).

When a heap spray attack is initially determined to be potentially present in the object based on the memory allocation for an application used to execute the object, the monitoring logic 276 may then scan the allocated memory for patterns appearing on a predetermined blacklist. Based on the information obtained from queries about the allocated virtual memory, the monitoring logic 276 may exclude certain portions of the allocated virtual heap 320. For example, the monitoring logic 276 may exclude those regions of memory having their permissions set to “read” because a heap spray attack typically will only insert code into regions of memory having permission set to, at least, “write”. This allows the monitoring logic 276 to increase the efficiency of the scan.

Referring to FIG. 5, a flowchart of an exemplary method for detecting a heap spray attack based on the detection of a blacklisted pattern is shown. In block 501, once a heap spray attack is determined to be present in an object, the monitoring logic 276 scans the memory allocated for the object for regions of memory at least a predetermined size (FIG. 5 uses a prescribed size of, for example, 128 kilobytes (Kb), though other sizes may be used in some embodiments). In block 502, for each region of memory of at least the prescribed size, the monitoring logic 276 scans for a pattern appearing on a predetermined blacklist of patterns at a predefined number of positions within the region of memory. The predefined number may be set to any value, such as, for example, three or four, where the predefined number is a static value or variable.

If a blacklisted pattern is not found (no at block 503), the scan ends for the current region and the monitoring logic 276 proceeds to analyze the next region of memory of at least the prescribed size (block 504). If a blacklisted pattern is detected (yes at block 503), the monitoring logic 276 scans the rest of the current region for the detected pattern (the “first pattern”) (block 505).

Thereafter, if a predetermined number of the first pattern is not found in a contiguous manner (no at block 506), the scan ends for the current region and the monitoring logic 276 proceeds to analyze the next region of memory of at least the prescribed size (block 507). However, if a predetermined number (e.g., two) of the first pattern is found in a contiguous manner (yes at block 506), the monitoring logic 276 scans the remainder of the current region of memory for a sequence including a NOP sled followed by potential shellcode followed by another NOP sled (herein referred to as a “NOP sled/potential shellcode/NOP sled sequence”) (block 508). Alternatively, the monitoring logic 276 may scan the current region of memory for a predefined number of NOP sleds instead of a NOP sled/potential shellcode/NOP sled sequence length. If a NOP sled/potential shellcode/NOP sled sequence of a predefined length is not found (no at block 509), the scan ends for the current region and the monitoring logic 276 proceeds to analyze the next region of memory of at least prescribed size (block 510). If a NOP sled/potential shellcode/NOP sled sequence of a predefined length is found (yes at block 509), an alert signaling the presence of a heap spray attack in the object is generated (block 511).

In one embodiment, a NOP sled normally constitutes a continuous repetition of NOP instructions within a region of memory. However, according to another embodiment, the NOP sleds may comprise a non-continuous repetition of NOPs wherein a particular type of non-NOP instruction may be interspersed among the NOP instructions.

Referring to FIGS. 6A-6D, flowcharts illustrating an in-depth exemplary method for detecting a heap spray attack based on the detection of a blacklisted pattern are shown. As shown in FIG. 6A, in block 601, the analysis of an object begins as a result of an initial detection of a heap spray attack based on the memory allocation for an application over a predefined time interval used to execute the object. In block 602, the monitoring logic 276 scans the memory allocated for the object within the virtual execution environment 272 (as discussed above) for blocks of memory of at least a predetermined size.

Upon detecting one or more blocks of memory of at least a prescribed size, the monitoring logic 276 scans each block of memory of at least a prescribed size at four predefined positions to locate a blacklisted pattern, unless the monitoring logic 276 has concluded that a heap spray attack is present in the object prior to such scanning Of course, as stated above, the number of predefined positions may vary and, as an illustrative example, four predefined positions are used in FIG. 6A.

In block 603, the monitoring logic 276 determines whether a blacklisted pattern appears at a first predefined position within a first block of memory of at least a prescribed size. The monitoring logic 276 will search the blocks of memory at the predefined positions in sections having a size corresponding to the length of the pattern(s) on the blacklist. The size of each section is referred to as the “search block size”. For example, the search block size may be four bytes when the client device 234 of FIG. 2A or 2B is running on a 32-bit operating system.

In one embodiment, a first predefined position is located within a predefined range of memory following the header such that the first predefined position begins at an address that is offset by a multiple of the search region size from the beginning of the entire region of allocated memory. If no blacklisted pattern appears at the first predefined position, the monitoring logic 276 proceeds to analyze a second predefined position (block 604), which will be discussed below.

If a blacklisted pattern is detected at the first predefined position (yes at block 603), the monitoring logic 276 scans the rest of the region of memory for the detected pattern (position 605). When the monitoring logic 276 has finished scanning the region of memory, if the number of contiguous occurrences of the detected pattern does not exceed a first predetermined threshold (no at block 606), the monitoring logic 276 proceeds to analyze the second predefined position (block 607). If the number of occurrences does exceed the first predetermined threshold (yes at block 606), the monitoring logic 276 marks that the current region of memory includes a potentially valid NOP sled and retrieves the location of potential shellcode (block 608). After retrieving the location of the potential shellcode, the monitoring logic 276 reads from the beginning of the potential shellcode until it encounters at least a predetermined number of contiguous blacklisted patterns (block 609). This would indicate the end of the potential shellcode and the beginning of a NOP sled, thereby forming a NOP sled/potential shellcode/NOP sled sequence. FIG. 6A sets the predetermined number of contiguous blacklisted patterns at two as an example.

If the monitoring logic 276 does not encounter at least the predetermined number of contiguous blacklisted patterns (no at block 610), the monitoring logic 276 proceeds to analyze the second predefined position (block 611). However, if at least the predetermined number of contiguous blacklisted patterns are detected (yes at block 610), the monitoring logic 276 searches the entire region of memory for NOP sleds that include a known pattern (block 612). If the number of NOP sleds detected does not exceed a second predetermined threshold (no at block 613), the monitoring logic 276 proceeds to analyze the second predefined position (block 614). However, if the number of NOP sleds detected is at least equal to the second predetermined threshold (yes at block 613), the monitoring logic determines whether the number of detected NOP sleds is at least equal to a third predetermined threshold (block 615). In an alternative embodiment, the monitoring logic 276 may determine whether the length of a NOP sled/potential shellcode/NOP sled sequence exceeds a predetermined length threshold as compared to determining whether the number of detected NOP sleds exceeds a second predetermined threshold.

If the third predetermined threshold is not met (no at block 615), the monitoring logic 276 determines whether the current block of memory is the last block of memory of at least a prescribed size (block 616). If the current block is the last block of memory of at least a prescribed size (yes at block 616), the monitoring logic 276 proceeds to analyze the second predefined position (block 617). However, if current block of memory is not the last block of memory of at least a prescribed size (no at block 616), the monitoring logic 276 scans the next block of memory of at least the predetermined size for NOP sleds to the current block of memory (block 618). The monitoring logic 276 then loops back to block 615 to evaluate whether the number of NOP sleds found exceeds the third predetermined threshold. If the third predetermined threshold is satisfied (yes at block 615), the monitoring logic 276 generates an event signaling detection of a heap spray attack (block 619). The monitoring logic 276 may assign a blacklist pattern score to the object after determining a heap spray attack may be included in the object based on detection of a NOP sled pattern appearing on the pattern blacklist, the blacklist pattern score signifying a second probability that the object that made the call is associated with a heap spray attack.

Referring to FIG. 6B, a flowchart illustrating the continuation of the in-depth exemplary method for detecting a heap spray attack based on the detection of a blacklisted pattern as depicted in FIG. 6A is shown. In FIG. 6B, the method illustrated mirrors that as described above in accordance with FIG. 6A; however, upon determining a need to terminate the search at the second predefined position, the monitoring logic 276 moves to a third predefined position and continues the scan to locate a blacklisted pattern (as shown in FIG. 6C). In addition, the second predefined position is located at an address that is offset by a multiple of the search region size from the beginning of the entire region of allocated memory, such that predefined position two is offset further in the region of allocated memory than the first predefined position. For example, the second predefined position may be the address that is offset by 512 Kb from the beginning of the region of allocated memory.

Referring to FIG. 6C, a flowchart illustrating the continuation of the in-depth exemplary method for detecting a heap spray attack based on the detection of a blacklisted pattern as depicted in FIGS. 6A-6B is shown. In FIG. 6C, the method illustrated mirrors that as described above in accordance with FIGS. 6A-6B; however, upon determining a need to terminate the search at the third predefined position, the monitoring logic 276 proceeds to analyze a fourth predefined position (as shown in FIG. 6D). In addition, the third predefined position is the address that is offset by the search region size from the end of the entire region of allocated memory. For example, the monitoring logic 276 analyzes the last four bytes of allocated memory if the client device 234 is running on a 32-bit operating system.

Referring to FIG. 6D, a flowchart illustrating the continuation of the in-depth exemplary method for detecting a heap spray attack based on the detection of a blacklisted pattern as depicted in FIGS. 6A-6C is shown. In FIG. 6D, the method illustrated mirrors that as described above in accordance with FIGS. 6A-6C; however, the fourth predefined position is located at an address that is offset by a multiple of the search region size from the end of the entire region of allocated memory. For example, the second predefined position may be the address that is offset by 512 Kb from the end of the region of allocated memory. In addition, upon determining the search should be terminated at the fourth predefined position, the monitoring logic 276 terminates the scan and concludes that a heap spray attack is not present in the object. Thereafter, the monitoring logic 276 may then disregard the partial scan and/or assign a blacklist pattern score of zero to the object. However, if the monitoring logic 276 detects a heap spray attack based on the method illustrated in FIGS. 6A-6D, the monitoring logic 276 may assign a blacklist pattern score to the object.

Although the monitoring logic 276 scans for blacklisted patterns when a heap spray attack is detected based on the memory allocation over a predefined time interval for an application. A NOP sled pattern included in the heap spray attack may go undetected if a pattern that does not appear on the blacklist is included in the exploit. Therefore, a method for detecting new NOP sled patterns has been derived. Furthermore, upon detecting a new NOP sled pattern, the monitoring logic 276 may add the detected new NOP instruction comprising the new NOP sled pattern to the blacklist of patterns, as discussed above. Thus, the monitoring logic 276 has effectively learned a new pattern; therefore, the detection of a new NOP instruction comprising a NOP sled and addition of the detected new NOP instruction to the blacklist of NOP instructions constitutes pattern learning.

Referring to FIG. 7, a flowchart of an exemplary method for detecting a new NOP sled pattern using a technique referred to as “pattern learning” is shown. In block 701, the presence of a heap spray attack has been detected based on the memory allocation over a predefined time interval for an application used to execute an object included in the received network traffic. In block 702, the monitoring module 321, which is operating in conjunction with the monitoring logic 276 (see FIG. 3), detects potential shellcode within the allocated virtual heap 320 but does not detect NOP sleds surrounding the potential shellcode and reports this to the monitoring logic 276.

In block 703, the monitoring module 321 retrieves the location of the potential shellcode and scans the allocated memory in two directions: (1) toward the beginning of the allocated memory starting from the beginning of the potential shellcode, and (2) toward the end of the allocated memory starting from the end of the potential shellcode. If the monitoring module 321 does not find a repeating pattern at both the beginning and end of the potential shellcode (no at block 704), no alert of a new NOP sled pattern is generated (block 705). Alternatively, the monitoring logic 276 may assign a new NOP sled pattern score of zero to the object. However, if the monitoring module 321 finds a repeating pattern at both the beginning and end of the potential shellcode (yes at block 704), an alert signaling that a new NOP sled pattern has been detected may be generated (block 706). In addition, the monitoring logic 276 may assign a new NOP sled pattern score to the object, the new NOP sled pattern score signifying a third probability that the object is associated with a heap spray attack.

In an alternative embodiment, the pattern comprising the new NOP sled pattern is not automatically added to the blacklist of patterns but the alert that is generated is received by the appropriate network administrator (such as the network administrator of the company employing the user of the network device that generated the alert). The network administrator may then determine whether the pattern comprising the potential new NOP sled pattern is actually a pattern likely to be associated with a heap spray attack or whether the alert was generated as a result of a false positive. In one embodiment, if the pattern comprising the potential new NOP sled pattern is determined to likely be associated with a heap spray attack, a configuration file may be created including the new pattern on the blacklist of patterns and the configuration file distributed among one or more network devices. For example, if the network administrator determines the potential new NOP sled pattern should be added to the blacklist of patterns, the network administrator may develop a configuration file including the new pattern on the blacklist and distribute the configuration file to all network devices (TDP systems and/or client devices) deploying the heap spray detection logic.

Referring to FIG. 8, an exemplary block diagram of a virtual heap allocated for an application executing an object included in received network traffic is shown. FIG. 8 illustrates block 703 of FIG. 7 (discussed above). Upon detecting the presence of potential shellcode but without detecting the presence of a NOP sled consisting of a known pattern, the monitoring module 321 retrieves the location of the beginning of the potential shellcode (location 801). The monitoring module 321 then scans the allocated virtual heap 320 in two directions represented by (A) and (B) in FIG. 8. Direction A illustrates the monitoring module 321 scanning the allocated virtual heap 320 from the beginning of the potential shellcode, location 801, toward the beginning of the allocated memory. Direction B illustrates the monitoring module 321 scanning the allocated virtual heap 320 from the location in the allocated virtual heap 320 just past the end of the potential shellcode, location 802, toward the end of the allocated virtual heap 320.

Referring back to FIG. 2A, the score determination logic 278 within the dynamic analysis engine 130 may be configured to compute a score based on the execution of the application within the one or more VMs 275 ₁, . . . , and/or 275 _(M). According to one embodiment of the disclosure, the score determination logic 278 comprises one or more software modules that are used to determine a probability (or level of confidence) that the object contains or may instigate a heap spray attack based on an observed “event” (i.e., behavior, such as, for example, a request for memory allocation, detected pattern, etc.) in the runtime environment. As discussed above, the score determination logic 278 may assign one or more of (i) a memory allocation score based on the memory allocation for an application used to execute an object, (ii) a blacklist pattern score based on a detected pattern appearing on a blacklist of patterns, and/or (iii) a new NOP sled pattern score based on a detected new NOP sled pattern. Of course, an overall score may be assigned to the object as a whole by mathematically combining the scores determined by analysis of different content associated with the same object to obtain an overall score for that object. The scores may be given equal weighting or the weighting for one or more observed features (e.g., memory allocation, detected pattern, etc.) may differ from another due to the probability that the observed features are associated with a heap spray attack and the likelihood of a false positive.

According to one embodiment of the disclosure, the overall score, or one or more of (i) a memory allocation score, (ii) a blacklist pattern score, and/or (iii) a new NOP sled pattern score may be used, at least in part, to determine whether the object causes or is otherwise associated with a heap spray attack. Some or all of the VM-based results 150 may be combined with its corresponding static-based results 140 in making this determination.

C. Exemplary Logic Layout of TDP System

Referring now to FIG. 9, an exemplary block diagram of logic associated with the TDP system 210 ₁ of FIGS. 2A-2B is shown. The TDP system 210 ₁ comprises one or more processors 900 that are coupled to the communication interface logic 910 via a first transmission medium 920. Communication interface logic 910 enables communication with other TDP systems 210 ₂-210 ₃ and management system 220 of FIG. 2A-2B. According to one embodiment of the disclosure, the communication interface logic 910 may be implemented as a physical interface including one or more ports for wired connectors. Additionally, or in the alternative, communication interface logic 910 may be implemented with one or more radio units for supporting wireless communications with other network devices.

The processor(s) 900 is further coupled to the persistent storage 930 via the transmission medium 925. According to one embodiment of the disclosure, the persistent storage 930 may include (i) the static analysis engine 120 including the signatures database 254, the vulnerability matching logic 253, the exploit matching logic 252 and the heuristics logic 250; (ii) the dynamic analysis engine 130 including the virtual execution logic 272, the monitoring logic 276 and the score determination logic 278; and (iv) the reporting logic 160. Of course, when implemented as hardware, one or more of these logic units could be implemented separately from each other.

The static analysis engine 120, if included, comprises one or more software modules that conduct a first static analysis on one or more incoming objects. As described above, this analysis may involve performing at least exploit signature checks and vulnerability signature checks on each incoming object to determine whether characteristics of any of these objects are indicative of an exploit and/or a heap spray attack. Upon detection that one or more suspicious objects have characteristics of an exploit and/or a heap spray attack, the static analysis engine 120 provides the suspicious object(s) to the virtual execution logic 270.

The virtual execution environment 272 comprises one or more software modules that are used for performing an in-depth, dynamic and real-time analysis of one or more objects included in the received network traffic using one or more VMs. More specifically, the virtual execution environment 272 is adapted to run the VM(s), which virtually processes the content associated with the one or more objects by simulating execution of such content in order to determine the presence of one or more exploits and/or heap spray attacks. Furthermore, the monitoring logic 276 monitors in real-time and may also log at least the memory allocation for predefined time intervals by the VM(s) configured with certain software. The monitoring logic 276 analyzes the allocated memory to detect patterns within the allocated memory that are indicative of a heap spray attack. In essence, the monitoring logic 276 identifies the effects that the object would have had on a physical network device with the same software/feature configuration. Such effects may include, among other things, large memory allocations during a predefined time interval and execution of operations within the allocated memory that would allow for the utilization of a heap spray attack in order to make realization of an exploit within the operating system easier.

Thereafter, according to the observed behavior of the virtually executed content, the monitoring logic 276 may determine that the content is associated with one or more exploits, where the severity of the observed anomalous behavior and/or the likelihood of the anomalous behavior results from an exploit, is evaluated and reflected in a “score” assigned by the score determination logic 278. Processor(s) 900 may invoke the reporting logic 160, which produces an alert for conveying information regarding the detected heap spray attack by the TDP system 210 ₁.

II. HEAP SPRAY DETECTION WITHIN A NETWORK DEVICE

According to an alternative embodiment of the disclosure, a network device may be configured to implement at least a monitoring logic independently of a separate physical device implementing a heap spray detection logic. In other words, a network device may be configured such that it is not reliant on separate physical device to implement the heap spray detection logic.

Referring to FIG. 10, a network device may be configured with a heap spray detection logic. In FIG. 10, for illustrative purposes, the network device is represented as a mobile network device 1000 (e.g., smartphone, tablet, laptop computer, netbook, etc.). The mobile network device 1000 includes a display screen 1010; a receiver and/or transmitter (e.g. transceiver) such as an antenna 1011; and monitoring logic 1020. The monitoring logic 1020 includes heap spray detection logic 1021 which monitors the behavior of applications from within the mobile network device 1000 as described above.

In one embodiment, the heap spray detection logic 1021 may be implemented as a software service within the mobile network device 1000. In such an embodiment, the heap spray detection logic 1021 starts and performs API hooking in order to observe function calls and/or system calls. When a function call or system call is observed, the heap spray detection logic 1021 analyzes the actions taken by the mobile network device 1000 as a result of the function call or system call to determine whether the object that made the call is associated with a heap spray attack. In one embodiment, the heap spray detection logic 1021 may operate as a daemon such that the heap spray detection logic 1021 runs as a background process on the mobile network device 1000. In yet another embodiment, the heap spray detection logic 1021 may be implemented as a software application on the mobile network device 1000.

The heap spray detection logic 1021 may analyze the memory allocation for the application executing the object as a result of the function call or system call. The heap spray detection logic 1021 may analyze information such as (i) the size of the region of memory allocated, (ii) the size of particular regions of memory within the region of memory allocated, addresses of particular regions of memory within the region of memory allocated, and/or (iii) the permissions of particular regions of memory within the region of memory allocated (wherein the permissions may include whether the region of memory is set to be readable, writable, and/or executable).

The heap spray detection logic 1021 observes the application as it allocates memory for a heap. The monitoring logic 1020 is equipped with a monitoring module (not shown) into the heap. The monitoring module obtains information and performs various tasks for the monitoring logic 1020 and/or the heap spray detection logic 1021 such as, among others, performing API hooking, detecting potential shellcode, detecting return-oriented programming (ROP), detecting NOP sleds and scanning the allocated heap for patterns to be added to a pattern blacklist.

If the allocation of memory exceeds a predetermined threshold, the heap spray detection logic 1021 observes the allocated memory over a predefined time interval. If the allocated memory remains above the predefined threshold for the entirety of the predefined time interval, the heap spray detection logic 1021 concludes that the object includes a heap spray attack. Thereafter, an alert signaling that the object that made the call may be associated with a heap spray attack may be generated.

Furthermore, the heap spray detection logic 1021 may scan the memory allocated for the object for a pattern appearing on a predetermined blacklist of patterns at a predefined number of positions within each region of memory of at least a predetermined size. If a blacklisted pattern is found, the heap spray detection logic 1021 scans the rest of the current region for the found pattern (the “first pattern”). Thereafter, if a predetermined number of the first pattern is not found in a contiguous manner, the scan ends for the current region and the heap spray detection logic 1021 proceeds to analyze the next region of memory of at least the predetermined size. However, if a predetermined number of the first pattern is found in a contiguous manner, the heap spray detection logic 1021 scans the remainder of the current region of memory for a predetermined threshold of NOP sleds. If the predetermined threshold of NOP sleds is not satisfied, the scan ends for the current region and the heap spray detection logic 1021 proceeds to analyze the next region of memory of at least the predetermined size. If the predetermined threshold of NOP sleds is satisfied, an alert signaling that the object that made the call may be associated with a heap spray attack may be generated.

Finally, the heap spray detection logic 1021 may be configured to scan the allocated memory for new NOP sled patterns. If determined to likely be associated with a heap spray attack, the pattern comprising the new NOP sled pattern may be added to the blacklist of patterns (the addition of a pattern determined likely to be associated with a heap spray attack may be referred to as “pattern learning”). A monitoring module 321 may detect potential shellcode within the allocated memory but does not detect NOP sleds surrounding the potential shellcode and reports this to the heap spray detection logic 1021. The monitoring module retrieves the location of the potential shellcode and scans the allocated memory in two directions: (1) toward the beginning of the allocated memory starting from the beginning of the potential shellcode, and (2) toward the end of the allocated memory starting from the end of the potential shellcode. If the monitoring module finds a repeating pattern at both the beginning and end of the potential shellcode, an alert signaling a new NOP sled pattern has been detected may be generated. Furthermore, the pattern comprising the new NOP sled pattern may be automatically added to the blacklist of patterns included on the network device deploying the heap spray detection logic. Alternatively, if the pattern is verified to likely be associated with a heap spray attack, a configuration file may be created and distributed to all network devices that connect to network 230 and deploy the heap spray detection logic. Once downloaded on a network device, the configuration file may update the blacklist of the network device to include the new pattern. Therefore, the blacklist of each network device connecting to network 230 and deploying the heap spray detection logic may be updated automatically as new patterns likely to be associated with a heap spray attack are detected.

The one or more alerts generated may be displayed to a user on the display screen 1010. For example, when the allocated memory remains above a predefined threshold for the entirety of a predefined time interval, an alert based on the memory allocation for the application may be displayed on the display screen 1010. Such alerts may present the user with the option to remediate the detected heap spray attack locally, i.e., on the mobile network device 1000, or the option to store the information associated with the detected heap spray attack for remediation by the appropriate network administrator. One example of remediation that may occur locally is a system restore of the mobile network device 1000 to system defaults. Furthermore, the information associated with the detected heap spray attack may be transmitted via the antenna 1011 to the appropriate network administrator. In addition, as discussed above, a score may be assigned based on one or more of (i) the memory allocation for an application used to execute an object, (ii) a detected pattern appearing on a blacklist of patterns, and/or (iii) a detected new NOP sled pattern. The one or more scores may also be displayed on the display screen 1010.

In the foregoing description, the invention is described with reference to specific exemplary embodiments thereof. It will, however, be evident that various modifications and changes may be made thereto without departing from the broader spirit and scope of the invention as set forth in the appended claims. 

What is claimed is:
 1. A computerized method, comprising: determining whether an amount of memory allocated for an application exceeds a predetermined threshold; responsive to determining the amount of allocated memory exceeds the predetermined threshold, scanning a region of the allocated memory for a predefined number of a first pattern, wherein the predefined number appears in a contiguous manner, the region being less than an entirety of the allocated memory; and responsive to detecting at least the predefined number of the first pattern in the contiguous manner, scanning a remainder of the allocated memory for a sequence of a first No Operation (NOP) sled and potential shellcode, wherein the remainder of the allocated memory excludes a subset of the allocated memory a Read permission from the scanning of the region of the allocated memory for the predefined number of the first pattern, and the subset being less than an entirety of the allocated memory.
 2. The computerized method of claim 1, wherein the scanning for the predefined number of the first pattern in the contiguous manner further comprises: scanning one or more portions of the region of allocated memory for the predefined number of the first pattern, the scanning of the one or more portions of the region of allocated memory starting at a plurality of different positions.
 3. The computerized method of claim 1, wherein the scanning for the predefined number of the first pattern in the contiguous manner further comprises: scanning a first predefined amount of a first portion of the region of allocated memory starting at a first position for the predefined number of the first pattern, the first position being at a first offset from the beginning of the first portion; and when the predefined number of the first pattern is not found by the scanning starting at the first position, scanning a second predefined amount of the first portion of the region of allocated memory starting at a second position for the predefined number of the first pattern, the second position being within a threshold of data from the end of the first portion of the region of allocated memory.
 4. The computerized method of claim 3, wherein the scanning for the predefined number of the first pattern further comprises: when the predefined number of the first pattern is not found by the scanning for the predefined number of the first pattern starting, at least, at the first position, scanning the first portion of the region of allocated memory starting at a third position for the for the predefined number of the first pattern, the third position being at a second offset from the beginning of the first portion, the second offset being larger than the first offset.
 5. The computerized method of claim 3, further comprising scanning the first portion of the region of allocated memory at one or more additional positions starting at positions other than the first position, the second position, and the third position.
 6. The computerized method of claim 1, wherein the potential shellcode includes computer code having characteristics indicating the capability to perform malicious activity.
 7. The computerized method of claim 6, wherein the first NOP sled includes a sequence of known instructions that facilitates execution of the potential shellcode.
 8. A computerized method, comprising: detecting potential shellcode at a first storage location within a region of memory allocated for an application; conducting a first search, in a first direction, at one or more storage locations prior to the first storage location within the region of allocated memory for at least one or more patterns; conducting a second search, in a second direction opposite the first direction, at one or more storage locations subsequent to the first storage location within the region of allocated memory for at least the one or more patterns, first portion of the allocated memory having a Read permission being excluded from the second search, the first portion being less than an entirety of the allocated memory; detecting a first pattern at one or more storage locations prior to the first storage location within the region of allocated memory; and detecting a second pattern at one or more storage locations subsequent to the first storage location with the region of allocated memory, wherein at least one of the first pattern or the second pattern is absent front a predefined list of patterns, the first location being a location at which the potential shellcode begins, and the first direction being toward the beginning of the allocated memory.
 9. The computerized method of claim 8, wherein the potential shellcode is computer code that includes one or more characteristics indicative of the capability to perform malicious activity.
 10. The computerized method of claim 9, wherein both the first pattern and the second pattern are absent from the predefined list of patterns.
 11. The computerized method of claim 9, wherein the second search begins at a second location and extends in a second direction, the second location being a location immediately following the potential shellcode, the second direction being toward the end of the allocated memory.
 12. The computerized method of claim 9, wherein the region of allocated memory is virtual memory.
 13. The computerized method of claim 9, wherein the at least the one or more patterns are a plurality of instructions.
 14. The computerized method of claim 13, wherein the at least the one or more patterns are a predefined sequence of at least four instructions.
 15. The computerized method of claim 9, further comprising: generating an alert based on the detection of at least one of the first pattern or the second pattern being a pattern on the predefined list of patterns.
 16. The computerized method of claim 9, further comprising: dynamically configuring a virtual machine with a software image representing a current operating state of a targeted client device, the software image representing content and structure of a storage volume for the targeted client device at a time of configuring the virtual machine; and detecting of the potential shellcode in the region of allocated memory, conducting the first search, conducting the second search, detecting the first pattern, and detecting the second pattern within the virtual machine.
 17. A system comprising: one or more processors; a storage module communicatively coupled to the one or more processors, the storage module includes logic to detect potential shellcode at a first storage location within a region of memory allocated for an application; conduct a first search in a first direction at one or more storage locations prior to the first storage location within the region of allocated memory for at least one or more patterns; conduct a second search in a second direction opposite the first direction at one or more storage locations subsequent to the first storage location within the region of allocated memory for at least the one or more patterns, a first portion of the allocated memory having a Read permission being excluded from the second search, the first portion being less than an entirety of the allocated memory; detect a first pattern at one or more storage locations prior to the first storage location within the region of allocated memory; and detect a second pattern at one or more storage locations subsequent to the first storage location with the region of allocated memory, wherein at least one or the first pattern, or the second pattern is absent from a predefined list of patterns, the first location being a location at which the potential shellcode begins, and the first direction being toward the beginning of the allocated memory.
 18. A computerized method, comprising: determining an amount of memory allocated for an application exceeds a memory threshold for a prescribed time threshold; responsive to the amount of memory allocated exceeding the memory threshold for the prescribed time threshold, performing a first scan of the amount of memory allocated for one or more patterns appearing on a predetermined blacklist; responsive to detecting at least a predefined number of a first pattern of the one or more patterns appearing on the predetermined blacklist in the contiguous manner, performing a second scan of the amount of memory allocated for a sequence of a first No Operation (NOP) sled and potential shellcode, a first portion of the allocated memory having a Read permission being excluded from the second scan, the first portion being less than an entirety of the allocated memory; and determining whether characteristics of a heap spray attack are present based on the first scan and the second scan.
 19. A non-transitory computer-readable storage medium having stored thereon instructions, the instructions being executable by one or more processors to perform operations including: determining whether an amount of memory allocated for an application exceeds a predetermined threshold for at least a predefined time threshold; performing a first scan of the region of allocated memory for a predefined number of a first pattern appearing on a predetermined blacklist in response to determining the amount of allocated memory exceeds the predetermined threshold; responsive to detecting at least the predefined number of the first pattern appearing on the predetermined blacklist, scanning a remainder of the region of allocated memory for a sequence of: (1) a first No Operation (NOP) sled and (ii) potential shellcode, wherein the remainder of the allocated memory excludes a first portion of the allocated memory having a Read permission, the first portion being less than an entirety of the allocated memory; and determining, based on the first scan and the scanning of the remainder of the region of allocated memory for a sequence of (i) the first No Operation (NOP) sled and (ii) the potential shellcode, whether characteristics of a heap spray attack have been detected.
 20. A system comprising: one or more processors; a storage module communicatively coupled to the one or more processors, the storage module includes logic to: determine an amount of allocated memory for an application exceeds a predetermined threshold for at least a prescribed time threshold; perform a first scan of a region of allocated memory for one or more patterns appearing on a predetermined blacklist in response to determining the amount of allocated memory exceeds the predetermined threshold for at least the prescribed time threshold, the region being less than an entirety of the allocated memory; responsive to detecting at least a predefined number of a first pattern of the one or more patterns appearing on the predetermined blacklist, scan a remainder of the allocated memory for a sequence of: (i) a first No Operation (NOP) sled and (ii) potential shellcode, wherein the remainder of the allocated memo excludes a first portion of the allocated memory having a Read permission, the first portion being less than the entirety of the allocated memory; and determine, based on the first scan and the scanning the remainder of the region of allocated memory for a sequence of (i) the first No Operation (NOP) sled and (ii) the potential shellcode, whether characteristics of a heap spray attack have been detected.
 21. The system of claim 20, wherein a characteristic of the one or more characteristics of a heap spray attack includes at least one sequence of (i) No Operation (NOP) instructions and (ii) a sequence of bytes at a particular location within the region of allocated memory, the sequence of bytes including computer code having one or more characteristics indicating the capability to perform malicious activity.
 22. The computerized method of claim 1 further comprising: determining, based on the scanning for the predefined number of the first pattern in the contiguous manner and the scanning for the sequence of the first NOP sled and the potential shellcode, whether characteristics of a heap spray attack have been detected.
 23. The computerized method of claim 1, wherein the first pattern appears on a predefined blacklist of patterns.
 24. The computerized method of claim 1, wherein the first NOP sled includes the predefined number of the first pattern in the contiguous manner.
 25. The computerized method of claim 1, wherein the subset of the allocated memory having a Read permission is excluded from the scanning of the region of the allocated memory for the predefined number of the first pattern.
 26. The computerized method of claim 8, wherein the first portion of the allocated memory having the Read permission is excluded from the first search.
 27. The system of claim 17, wherein the first portion of the allocated memory having the Read permission is excluded from the first search.
 28. The computerized method of claim 18, wherein the first portion of the allocated memory having the Read permission is excluded from the first scan.
 29. The non-transitory computer-readable storage medium of claim 19, wherein the first portion of the allocated memory having the Read permission is excluded from the first scan.
 30. The system of claim 20, wherein the first portion of the allocated memory having the Read permission is excluded from the first scan. 